package com.dict.process;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.dict.classes.Word;

public class AddWordProcess {

	public void doProcess(HttpServletRequest request,
            HttpServletResponse response) throws Exception {
		
		String strWord = request.getParameter("word");
	    String strMeaning = request.getParameter("meaning");
	    String strUserId = request.getParameter("UserId");
	    
	    Word word = new Word();
	    
	    word.setWord(strWord);
	    word.setMeaning(strMeaning);
	    word.setUserId(Integer.parseInt(strUserId));

	    try {
			word.store();
		} catch (Exception e) {
			e.printStackTrace();
		}
		finally
		{
			response.sendRedirect("index.jsp?content=allWords");
		}
	}
}